#include "sendbox.h"
#include "ui_sendbox.h"

SendBox::SendBox(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SendBox)
{
    ui->setupUi(this);
    ui->label_2->setTextInteractionFlags(Qt::TextSelectableByMouse);
    ui->label_2->setWordWrap(true);
    ui->label->setScaledContents(true);
    setStyleSheet("#label_2 { padding: 12px; }");
}

SendBox::~SendBox()
{
    delete ui;
}

void SendBox::setTextColor(const QColor &textcolor)
{
    setStyleSheet(QString("#label_2 {color: %1;}").arg(textcolor.name()));
}

void SendBox::setBackgroundColor(const QColor &backgroundcolor)
{
    setStyleSheet(QString("#label_2{background-color: %1;}").arg(backgroundcolor.name()));
}

void SendBox::setBordetRadius(const int radius)
{
    setStyleSheet(QString("#label_2{border-radius: %1;}").arg(QString::number(radius)));
}

void SendBox::setStyleSheet(const QString &style)
{
    QWidget::setStyleSheet(styleSheet()+style);
}

void SendBox::setAvatar(const QPixmap &avtar)
{

    QRegion region(ui->label->rect(), QRegion::Ellipse);
    ui->label->setMask(region);
    ui->label->setPixmap(avtar);
}


void SendBox::setText(const QString &text)
{
    ui->label_2->setText(text);
}
